package com.gopay.common.domain.cps.vo;

import java.math.BigDecimal;

import com.gopay.common.cipher.utils.LoggerMaskUtils;
import com.gopay.common.constants.cps.RefundFlag;
import com.gopay.common.domain.cps.CpsGenMainOrder;
import com.gopay.common.domain.cps.CpsGenReceiptOrder;
import com.gopay.common.util.DateUtils;

/**
 * 
 * 收款类订单
 * 
 * 现在订单分父子表，应为父子表必须同时完成动作，所以放在Manager中进行事务实现
 * 
 * @FullCpsGenRecvOrder.java
 * @author MA HUAN
 * @2012-12-29 下午10:03:53 www.gopay.com.cn Inc.All rights reserved.
 */
public class FullCpsGenRecvOrder extends CpsGenOrder{

    private static final long serialVersionUID = -5672665662560804481L;
    
    //子表属性
    private String otherRecvInfo;
    private BigDecimal totalRefundFeeAmt;
    private BigDecimal totalRefundAmt;
    private BigDecimal merTiliuAmt;
    private String merTiliuRecvAcct;
    private BigDecimal orderBankFeeAmt;
    private String authStaCd;
    private String authId;
    private RefundFlag isRefund;
    private String subRemark1;
    private String subRemark2;
    
    private BigDecimal refundUsedLimit;
    
    ///快捷支付身份验证版 新加字段 by  dongdh
    private String buyerRealMobile; //商户上送真实手机号
    private String buyerRealCertNo; //商户上送真实身份证号
    private String buyerRealBankAcctNum; //商户上送真实银行卡号
    private String buyerRealName;   //商户上送真实姓名
    //modify by tangyang at 20160725 增加字段，修改 epBankCardNo被更新为空的bug
    private String epBankCardNo;
    
    //  add  by dongdh  20160504
    private BigDecimal authenticationFee; ///鉴权手续费
    private String smsAdvice;   //短信建议
    private String authenticationResult;  //鉴权结果
    private String certificateType;  //证件类型
    private String bankCardType;  //卡类型
    private String creditCardExpired; // 信用卡 有效期
    private String dfSettleTime;
    private String contractNo;

    //为了方便测试,不被老corn跑订单,该字段已作废
    private String otherRecvFlag;//分账标识

    private String otherRecvType;//分账方式
    /*通用分账  added by Chenyu Li at 2018/3/5 start*/
    private String isDeductFeeAmt; //是否扣除手续费标志，0未扣除，1已扣除
    private String otherRecvSytle;  //分账类型 ，1，实时；2，延时
    private String otherRecvTime;   //分账开始时间
    private String otherRecvStatus;  //分账状态;1,待分账，2，分账成功，3，分账失败
    private String isForceRecv;      //是否强制分账 0，正常，1强制


    /*通用分账  added by Chenyu Li at 2018/3/5 end*/
    //add by liuyong 增加交易实际IP
    private String remoteIp;
    
    public FullCpsGenRecvOrder() {
         
    }

    public FullCpsGenRecvOrder(CpsGenMainOrder main, CpsGenReceiptOrder recv) {
        setGopayOrderId(main.getGopayOrderId());
        setTransDtlSq(main.getTransDtlSq());
        setGopayIntTxnCd(main.getGopayIntTxnCd());
        setMerId(main.getMerId());
        setMerOrderId(main.getMerOrderId());
        setMerTxnTm(main.getMerTxnTm());
        setGatewaySource(main.getGatewaySource());
        setGatewayChannel(main.getGatewayChannel());
        setOrderType(main.getOrderType());
        setPayChannel(main.getPayChannel());
        setGopayTxnTm(main.getGopayTxnTm());
        setRelevanceGopayOrderId(main.getRelevanceGopayOrderId());
        setTotalOrderAmt(main.getTotalOrderAmt());
        setTotalOrderFeeAmt(main.getTotalOrderFeeAmt());
        setOrderDealAmt(main.getOrderDealAmt());
        setOrderRealFeeAmt(main.getOrderRealFeeAmt());
        setSettleAmt(main.getSettleAmt()); // update by dongdh 20160921 加入结算金额
        setOrderFeePayer(main.getOrderFeePayer());
        setCurType(main.getCurType());
        setMainRecvAcct(main.getMainRecvAcct());
        setMainRecvAcctProdCode(main.getMainRecvAcctProdCode());
        setMainRecvAcctProdName(main.getMainRecvAcctProdName());
        setMainRecvCustId(main.getMainRecvCustId());
        setPayAcct(main.getPayAcct());
        setMainPayAcctProdCode(main.getMainPayAcctProdCode());
        setMainPayAcctProdName(main.getMainPayAcctProdName());
        setPayCustId(main.getPayCustId());
        setTxnStaCd(main.getTxnStaCd());
        setOutStlmId(main.getOutStlmId());
        setOutPayAcct(main.getOutPayAcct());
        setTranFinishTime(main.getTranFinishTime());
        setOrderStlmTime(main.getOrderStlmTime());
        setLastUpdTrancode(main.getLastUpdTrancode());
        setRemark1(main.getRemark1());
        setRemark2(main.getRemark2());
        setMerTxnAmt(main.getMerTxnAmt());
        setReversalFlag(main.getReversalFlag());

        setMerCommAmt(main.getMerCommAmt());
        
        setAccountPoint(main.getAccountPoint());
        setErrCode(main.getErrCode());
        setErrMsg(main.getErrMsg());
        // 由于钱包个人扫码交易退款 丢失了子交易类型 再次加上。 add by jianglijun 20171214
        setChildTranType(main.getChildTranType());
        setOtherAcct(main.getOtherAcct());
        //recv必须非空校验 edit by fanghw 20140606
        if(recv!=null){
            this.otherRecvInfo = recv.getOtherRecvInfo();
            this.totalRefundFeeAmt = recv.getTotalRefundFeeAmt();
            this.totalRefundAmt = recv.getTotalRefundAmt();
            this.merTiliuAmt = recv.getMerTiliuAmt();
            this.merTiliuRecvAcct = recv.getMerTiliuRecvAcct();
            this.orderBankFeeAmt = recv.getOrderBankFeeAmt();
            this.authStaCd = recv.getAuthStaCd();
            this.authId = recv.getAuthId();
            this.isRefund = recv.getIsRefund();
            this.subRemark1 = recv.getRemark1();
            this.subRemark2 = recv.getRemark2();
            
            this.refundUsedLimit=recv.getRefundUsedLimit();
            
          //快捷支付 身份验证版 新增 by dongdh
            this.buyerRealBankAcctNum = recv.getBuyerRealBankAcctNum();
            this.buyerRealCertNo = recv.getBuyerRealCertNo();
            this.buyerRealMobile = recv.getBuyerRealMobile();
            this.buyerRealName = recv.getBuyerRealName();
            
           //  add  by dongdh  20160504
            this.authenticationFee = recv.getAuthenticationFee();
            this.smsAdvice = recv.getSmsAdvice();
            this.authenticationResult = recv.getAuthenticationResult();
            this.certificateType = recv.getCertificateType();
            this.bankCardType = recv.getBankCardType();
            this.creditCardExpired = recv.getCreditCardExpired();
            
            //modify by tangyang at 20160725
            this.epBankCardNo  = recv.getEpBankCardNo();

            this.dfSettleTime = recv.getDfSettleTime();

            //add by sh.jiao 20170401
            this.contractNo = recv.getContractNo();
            //add by zhuliang 20170810
            this.otherRecvFlag = recv.getOtherRecvFlag();
            this.otherRecvType = recv.getOtherRecvType();

            /*通用分账  added by Chenyu Li at 2018/3/7 start*/
            this.isDeductFeeAmt = recv.getIsDeductFeeAmt();
            this.otherRecvSytle = recv.getOtherRecvSytle();
            this.otherRecvTime = recv.getOtherRecvTime();
            this.otherRecvStatus = recv.getOtherRecvStatus();
            this.isForceRecv = recv.getIsForceRecv();
            /*通用分账  added by Chenyu Li at 2018/3/7 end*/
        }
    }
    
    public CpsGenMainOrder getCpsGenMainOrder() {
        CpsGenMainOrder main = new CpsGenMainOrder();
        
        main.setGopayOrderId(getGopayOrderId());
        main.setTransDtlSq(getTransDtlSq());
        main.setGopayIntTxnCd(getGopayIntTxnCd());
        main.setMerId(getMerId());
        main.setMerOrderId(getMerOrderId());
        main.setMerTxnTm(getMerTxnTm());
        main.setGatewaySource(getGatewaySource());
        main.setGatewayChannel(getGatewayChannel());
        main.setOrderType(getOrderType());
        main.setPayChannel(getPayChannel());
        main.setGopayTxnTm(getGopayTxnTm());
        main.setRelevanceGopayOrderId(getRelevanceGopayOrderId());
        main.setTotalOrderAmt(getTotalOrderAmt());
        main.setTotalOrderFeeAmt(getTotalOrderFeeAmt());
        main.setOrderDealAmt(getOrderDealAmt());
        main.setOrderRealFeeAmt(getOrderRealFeeAmt());
        main.setOrderFeePayer(getOrderFeePayer());
        main.setCurType(getCurType());
        main.setMainRecvAcct(getMainRecvAcct());
        main.setMainRecvAcctProdCode(getMainRecvAcctProdCode());
        main.setMainRecvAcctProdName(getMainRecvAcctProdName());
        main.setMainRecvCustId(getMainRecvCustId());
        main.setPayAcct(getPayAcct());
        main.setMainPayAcctProdCode(getMainPayAcctProdCode());
        main.setMainPayAcctProdName(getMainPayAcctProdName());
        main.setPayCustId(getPayCustId());
        main.setTxnStaCd(getTxnStaCd());
        main.setOutStlmId(getOutStlmId());
        main.setOutPayAcct(getOutPayAcct());
        main.setTranFinishTime(getTranFinishTime());
        main.setOrderStlmTime(getOrderStlmTime());
        main.setCreatedTs(DateUtils.getSystemDate());
        main.setLastUpdTs(DateUtils.getSystemDate());
        main.setLastUpdTrancode(getLastUpdTrancode());
        main.setRemark1(getRemark1());
        main.setRemark2(getRemark2());
        main.setMerTxnAmt(getMerTxnAmt());
        main.setReversalFlag(getReversalFlag());
        main.setRemark3(getRemark3());
        //记账点
        main.setAccountPoint(this.getAccountPoint());
        main.setChildTranType(getChildTranType());
        /**云账户佣金增加**/
        main.setMerCommAmt(this.getMerCommAmt()); 
        main.setMerCommPayer(this.getMerCommPayer());

        main.setSettleAmt(getSettleAmt());
        main.setErrCode(getErrCode());
        main.setErrMsg(getErrMsg());
        //增加交易实际IP add by liuyong 20171207
        main.setRemoteIp(getRemoteIp());
        main.setOtherAcct(getOtherAcct());
        return main;
    }
    
    public CpsGenReceiptOrder getCpsGenReceiptOrder() {
        CpsGenReceiptOrder recv = new CpsGenReceiptOrder();
        recv.setGopayOrderId(getGopayOrderId());
        recv.setOtherRecvInfo(otherRecvInfo);
        recv.setTotalRefundFeeAmt(totalRefundFeeAmt);
        recv.setTotalRefundAmt(totalRefundAmt);
        recv.setMerTiliuAmt(merTiliuAmt);
        recv.setMerTiliuRecvAcct(merTiliuRecvAcct);
        recv.setOrderBankFeeAmt(orderBankFeeAmt);
        recv.setAuthStaCd(authStaCd);
        recv.setAuthId(authId);
        recv.setIsRefund(isRefund);
        recv.setCreatedTs(DateUtils.getSystemDate());
        recv.setLastUpdTs(DateUtils.getSystemDate());
        recv.setLastUpdTrancode(getLastUpdTrancode());
        recv.setRemark1(subRemark1);
        recv.setRemark2(subRemark2);
        
        recv.setRefundUsedLimit(refundUsedLimit);
        
        //快捷支付 身份验证版 新增 by dongdh
        recv.setBuyerRealBankAcctNum(buyerRealBankAcctNum);
        recv.setBuyerRealCertNo(buyerRealCertNo);
        recv.setBuyerRealMobile(buyerRealMobile);
        recv.setBuyerRealName(buyerRealName);
        //add by tangyang at 20160725
        recv.setEpBankCardNo(epBankCardNo);
        
        //  add  by dongdh  20160504
        recv.setAuthenticationFee(authenticationFee);
        recv.setAuthenticationResult(authenticationResult);
        recv.setSmsAdvice(smsAdvice);
        recv.setCertificateType(certificateType);
        recv.setBankCardType(bankCardType);
        recv.setCreditCardExpired(creditCardExpired);

        //add by sh.jiao 20170401
        recv.setContractNo(contractNo);
        //add by zhuliang 20170810
        recv.setOtherRecvFlag(otherRecvFlag);
        recv.setOtherRecvType(otherRecvType);

        /*通用分账  added by Chenyu Li at 2018/3/7 start*/
        recv.setIsDeductFeeAmt(isDeductFeeAmt);
        recv.setOtherRecvStatus(otherRecvStatus);
        recv.setOtherRecvSytle(otherRecvSytle);
        recv.setOtherRecvTime(otherRecvTime);
        recv.setIsForceRecv(isForceRecv);
        /*通用分账  added by Chenyu Li at 2018/3/7 end*/
        return recv;
    }

    public String getOtherRecvInfo() {
        return otherRecvInfo;
    }

    public void setOtherRecvInfo(String otherRecvInfo) {
        this.otherRecvInfo = otherRecvInfo;
    }

    public BigDecimal getTotalRefundFeeAmt() {
        return totalRefundFeeAmt;
    }

    public void setTotalRefundFeeAmt(BigDecimal totalRefundFeeAmt) {
        this.totalRefundFeeAmt = totalRefundFeeAmt;
    }

    public BigDecimal getTotalRefundAmt() {
        return totalRefundAmt;
    }

    public void setTotalRefundAmt(BigDecimal totalRefundAmt) {
        this.totalRefundAmt = totalRefundAmt;
    }

    public BigDecimal getMerTiliuAmt() {
        return merTiliuAmt;
    }

    public void setMerTiliuAmt(BigDecimal merTiliuAmt) {
        this.merTiliuAmt = merTiliuAmt;
    }

    public String getMerTiliuRecvAcct() {
        return merTiliuRecvAcct;
    }

    public void setMerTiliuRecvAcct(String merTiliuRecvAcct) {
        this.merTiliuRecvAcct = merTiliuRecvAcct;
    }

    public BigDecimal getOrderBankFeeAmt() {
        return orderBankFeeAmt;
    }

    public void setOrderBankFeeAmt(BigDecimal orderBankFeeAmt) {
        this.orderBankFeeAmt = orderBankFeeAmt;
    }

    public String getAuthStaCd() {
        return authStaCd;
    }

    public void setAuthStaCd(String authStaCd) {
        this.authStaCd = authStaCd;
    }

    public String getAuthId() {
        return authId;
    }

    public void setAuthId(String authId) {
        this.authId = authId;
    }

    public RefundFlag getIsRefund() {
        return isRefund;
    }

    public void setIsRefund(RefundFlag isRefund) {
        this.isRefund = isRefund;
    }

    public String getSubRemark1() {
        return subRemark1;
    }

    public void setSubRemark1(String subRemark1) {
        this.subRemark1 = subRemark1;
    }

    public String getSubRemark2() {
        return subRemark2;
    }

    public void setSubRemark2(String subRemark2) {
        this.subRemark2 = subRemark2;
    }
    
    public BigDecimal getRefundUsedLimit() {
		return refundUsedLimit;
	}

	public void setRefundUsedLimit(BigDecimal refundUsedLimit) {
		this.refundUsedLimit = refundUsedLimit;
	}

	public String getBuyerRealMobile() {
		return buyerRealMobile;
	}

	public void setBuyerRealMobile(String buyerRealMobile) {
		this.buyerRealMobile = buyerRealMobile;
	}

	public String getBuyerRealCertNo() {
		return buyerRealCertNo;
	}

	public void setBuyerRealCertNo(String buyerRealCertNo) {
		this.buyerRealCertNo = buyerRealCertNo;
	}

	public String getBuyerRealBankAcctNum() {
		return buyerRealBankAcctNum;
	}

	public void setBuyerRealBankAcctNum(String buyerRealBankAcctNum) {
		this.buyerRealBankAcctNum = buyerRealBankAcctNum;
	}

	public String getBuyerRealName() {
		return buyerRealName;
	}

	public void setBuyerRealName(String buyerRealName) {
		this.buyerRealName = buyerRealName;
	}

    public BigDecimal getAuthenticationFee() {
        return authenticationFee;
    }

    public void setAuthenticationFee(BigDecimal authenticationFee) {
        this.authenticationFee = authenticationFee;
    }

    public String getSmsAdvice() {
        return smsAdvice;
    }

    public void setSmsAdvice(String smsAdvice) {
        this.smsAdvice = smsAdvice;
    }

    public String getAuthenticationResult() {
        return authenticationResult;
    }

    public void setAuthenticationResult(String authenticationResult) {
        this.authenticationResult = authenticationResult;
    }

    public String getCertificateType() {
        return certificateType;
    }

    public void setCertificateType(String certificateType) {
        this.certificateType = certificateType;
    }

    public String getBankCardType() {
        return bankCardType;
    }

    public void setBankCardType(String bankCardType) {
        this.bankCardType = bankCardType;
    }

    public String getCreditCardExpired() {
        return creditCardExpired;
    }

    public void setCreditCardExpired(String creditCardExpired) {
        this.creditCardExpired = creditCardExpired;
    }
	

	public String getEpBankCardNo() {
		return epBankCardNo;
	}

	public void setEpBankCardNo(String epBankCardNo) {
		this.epBankCardNo = epBankCardNo;
	}

    public String getDfSettleTime() {
        return dfSettleTime;
    }

    public void setDfSettleTime(String dfSettleTime) {
        this.dfSettleTime = dfSettleTime;
    }

    public String getContractNo() {
        return contractNo;
    }

    public void setContractNo(String contractNo) {
        this.contractNo = contractNo;
    }

    public String getOtherRecvFlag() {
        return otherRecvFlag;
    }

    public void setOtherRecvFlag(String otherRecvFlag) {
        this.otherRecvFlag = otherRecvFlag;
    }

    public String getOtherRecvType() {
        return otherRecvType;
    }

    public void setOtherRecvType(String otherRecvType) {
        this.otherRecvType = otherRecvType;
    }

    public String getRemoteIp() {
        return remoteIp;
    }

    public void setRemoteIp(String remoteIp) {
        this.remoteIp = remoteIp;
    }

    public String getIsDeductFeeAmt() {
        return isDeductFeeAmt;
    }

    public void setIsDeductFeeAmt(String isDeductFeeAmt) {
        this.isDeductFeeAmt = isDeductFeeAmt;
    }

    public String getOtherRecvSytle() {
        return otherRecvSytle;
    }

    public void setOtherRecvSytle(String otherRecvSytle) {
        this.otherRecvSytle = otherRecvSytle;
    }

    public String getOtherRecvTime() {
        return otherRecvTime;
    }

    public void setOtherRecvTime(String otherRecvTime) {
        this.otherRecvTime = otherRecvTime;
    }

    public String getOtherRecvStatus() {
        return otherRecvStatus;
    }

    public void setOtherRecvStatus(String otherRecvStatus) {
        this.otherRecvStatus = otherRecvStatus;
    }

    public String getIsForceRecv() {
        return isForceRecv;
    }

    public void setIsForceRecv(String isForceRecv) {
        this.isForceRecv = isForceRecv;
    }


    /**
     * 处理掩码展示 20171130 ssj
     */
    @Override
    public String toString() {
        return "FullCpsGenRecvOrder{" +
                "otherRecvInfo='" + otherRecvInfo + '\'' +
                ", totalRefundFeeAmt=" + totalRefundFeeAmt +
                ", totalRefundAmt=" + totalRefundAmt +
                ", merTiliuAmt=" + merTiliuAmt +
                ", merTiliuRecvAcct='" + merTiliuRecvAcct + '\'' +
                ", orderBankFeeAmt=" + orderBankFeeAmt +
                ", authStaCd='" + authStaCd + '\'' +
                ", authId='" + authId + '\'' +
                ", isRefund=" + isRefund +
                ", subRemark1='" + subRemark1 + '\'' +
                ", subRemark2='" + subRemark2 + '\'' +
                ", refundUsedLimit=" + refundUsedLimit +
                ", buyerRealMobile='" + LoggerMaskUtils.maskString(buyerRealMobile) + '\'' +
                ", buyerRealCertNo='" +LoggerMaskUtils.maskString( buyerRealCertNo) + '\'' +
                ", buyerRealBankAcctNum='" + LoggerMaskUtils.maskString(buyerRealBankAcctNum) + '\'' +
                ", buyerRealName='" + buyerRealName + '\'' +
                ", epBankCardNo='" + LoggerMaskUtils.maskString(epBankCardNo )+ '\'' +
                ", authenticationFee=" + authenticationFee +
                ", smsAdvice='" + smsAdvice + '\'' +
                ", authenticationResult='" + authenticationResult + '\'' +
                ", certificateType='" + certificateType + '\'' +
                ", bankCardType='" + bankCardType + '\'' +
                ", creditCardExpired='****'" +
                ", dfSettleTime='" + dfSettleTime + '\'' +
                ", contractNo='" + contractNo + '\'' +
                ", otherRecvFlag='" + otherRecvFlag + '\'' +
                ", otherRecvType='" + otherRecvType + '\'' +
                ", isDeductFeeAmt='" + isDeductFeeAmt + '\'' +
                ", otherRecvSytle='" + otherRecvSytle + '\'' +
                ", otherRecvTime='" + otherRecvTime + '\'' +
                ", otherRecvStatus='" + otherRecvStatus + '\'' +
                ", isForceRecv='" + isForceRecv + '\'' +
                '}';
    }
}